addTemplateListener

abstract fun addTemplateListener(@NonNull listener: TemplateListener)

Registers a TemplateListener to receive notifications about template-related events.

Template events can include notifications when a new template starts displaying, when a template finishes, or other significant lifecycle changes related to the active template presentation.

The provided listener will be invoked when such events occur. Multiple listeners can be registered, and they will be notified in an unspecified order. It is crucial to call removeTemplateListener when the listener is no longer needed (e.g., when a component is destroyed) to prevent memory leaks.

Parameters

listener

The non-null TemplateListener instance to register. Adding the same listener instance multiple times may result in it being called multiple times for each event, or it might be ignored if already registered (behavior should be consistent).

See also

Throws

if listener is null.